package com.tengju.user.infrastructure.repository.convert;

import com.tengju.user.domain.model.chief.ChiefId;
import com.tengju.user.domain.model.chief.ChiefSecCount;
import com.tengju.user.infrastructure.persistence.mybatis.dataobject.ChiefSecCountDO;

/**
 * @Author: 大木
 * @Date: 2021/7/21 3:12 下午
 */
public class ChiefGenSecInfoRelationConvert {
    public static ChiefSecCount convert(ChiefSecCountDO chiefGenSecInfoRelationDO) {
        if (chiefGenSecInfoRelationDO == null) {
            return null;
        }
        return new ChiefSecCount(
                new ChiefId(chiefGenSecInfoRelationDO.getChiefId()),
                chiefGenSecInfoRelationDO.getSecCount()
                );
    }

    public static ChiefSecCountDO convert(ChiefSecCount chiefGenSecInfoRelation) {
        if (chiefGenSecInfoRelation == null) {
            return null;
        }
        ChiefSecCountDO chiefGenSecInfoRelationDO = new ChiefSecCountDO();
        chiefGenSecInfoRelationDO.setChiefId(chiefGenSecInfoRelation.getChiefId().getValue());
        chiefGenSecInfoRelationDO.setSecCount(chiefGenSecInfoRelationDO.getSecCount());
        return chiefGenSecInfoRelationDO;
    }
}
